UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wYruePB0iCD5lce88m5rjqTC6VpmP6BvFPzc5HMM7bo=' 
WHERE 
  key_id = '4f3fbda2bdeab957bcb6477dbf311045f4933c1e5f0a6c72069cee52e3eefa27' 
  AND (
    token = 'wYruePB0iCD5lce88m5rjqTC6VpmP6BvFPzc5HMM7bo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024