UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TBxwpI+O5xa+3Npliz9rvRzUdmRyEAzUmfcPUv9o4vk=' 
WHERE 
  key_id = '54c3c21c2b412896f9566d940d77f609ef965de9ac208a77769b1952dc77d680' 
  AND (
    token = 'TBxwpI+O5xa+3Npliz9rvRzUdmRyEAzUmfcPUv9o4vk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031