UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJiR73VJLclFJscNhDduoAhisYVCR6f2V4qTLYXMXBo=' 
WHERE 
  key_id = 'aeca7aa87f4db009c748c7097eb3d102e3e93963475101bb4f4cbf20121b4e61' 
  AND (
    token = 'aJiR73VJLclFJscNhDduoAhisYVCR6f2V4qTLYXMXBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037