UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jdUj76L7v1r80/7YNYsZu+tzBXPpEk4QyMkkv8979dY=' 
WHERE 
  key_id = '0bbb52347222263d072e3d793304ef1e087d66b2fd294924185e27104b6ac00b' 
  AND (
    token = 'jdUj76L7v1r80/7YNYsZu+tzBXPpEk4QyMkkv8979dY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043