UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6GHkHrDKQanDu8DvYWJ252VSpJUKSUM/rxyMW5DBbXo=' 
WHERE 
  key_id = 'b61fd783ae9d790bfb9f70c8f6a0bab55ac4f45331414ce4cbddd4a5c7bb7226' 
  AND (
    token = '6GHkHrDKQanDu8DvYWJ252VSpJUKSUM/rxyMW5DBbXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026