UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+XYzBxfUDJuxhO+jUxMMfS5t43AtnWScbBHQiBqvSw=' 
WHERE 
  key_id = '6b892d70df1f62d387f8b9fa1f18289416b3a0d27962c06a20adcc097b5c1efe' 
  AND (
    token = 'P+XYzBxfUDJuxhO+jUxMMfS5t43AtnWScbBHQiBqvSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038