UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fs/q2V05+mDXsqRtB0Tv2U/9/Zsj4O1YcY5WBWzNt9o=' 
WHERE 
  key_id = '51369cf1116088d87a693868eb43cb93987676bf5490f8582fceb4409f1d6245' 
  AND (
    token = 'fs/q2V05+mDXsqRtB0Tv2U/9/Zsj4O1YcY5WBWzNt9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062