UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iza2+Sf/VrsNKEbGHS9rpC8IWeMdpTgjkCDFyPfiCLM=' 
WHERE 
  key_id = 'ec2edf6febfc45a5711b1167a67e5789a868cdffa59581e042cf5b9599f62154' 
  AND (
    token = 'iza2+Sf/VrsNKEbGHS9rpC8IWeMdpTgjkCDFyPfiCLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029