UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bS2hF+5A4byFeCD0RgjE/sdntE8zmKWgYkmuxM4ghjI=' 
WHERE 
  key_id = '9cf66a85593a54f780748510a0641dcc9ffd8a1fb54a20b4cb55b8a5460f6933' 
  AND (
    token = 'bS2hF+5A4byFeCD0RgjE/sdntE8zmKWgYkmuxM4ghjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027