UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bW1XjpCPISEJ1Ephp5dIdVn5WvxGHc4OErnMZvOdVkQ=' 
WHERE 
  key_id = '38938a7d949d9eadbc41735cafaef49768a849d1bba4ac0777d018b059c75053' 
  AND (
    token = 'bW1XjpCPISEJ1Ephp5dIdVn5WvxGHc4OErnMZvOdVkQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050