UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'etrVKOFQ9xsZubpoHEWaXlRqWXNFYAVk21+DwcpI3ho=' 
WHERE 
  key_id = '01c1f6b91511555aa8302bffbeea8fed5147455d281b38d1a31bd4418e328430' 
  AND (
    token = 'etrVKOFQ9xsZubpoHEWaXlRqWXNFYAVk21+DwcpI3ho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027