UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZEtqiK7chw5+9SsBQGpDMg2KQe45doH2jUb8Xe5tY58=' 
WHERE 
  key_id = 'f3662ffa643026c3a6c18a47d5dcae73137ce40c04b7af144babbd2a436d7f09' 
  AND (
    token = 'ZEtqiK7chw5+9SsBQGpDMg2KQe45doH2jUb8Xe5tY58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032