UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9TbW8RISGhA+naHHZAMja8J9W3ooil+oC4VvSdoSHH0=' 
WHERE 
  key_id = '0c8ed16b6432254fc6d85ceab24742879242ee41ce0f6148e722db609aa01c12' 
  AND (
    token = '9TbW8RISGhA+naHHZAMja8J9W3ooil+oC4VvSdoSHH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044