UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3NbtIuFg0vf8+hZbuXWiwLeEf31tMJgDiDAqgEamIHA=' 
WHERE 
  key_id = 'fece5fc39fda50b9f65b220b3b253dc49c5da09cf2218567daf1150098ce3c2d' 
  AND (
    token = '3NbtIuFg0vf8+hZbuXWiwLeEf31tMJgDiDAqgEamIHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025