UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7bzMgOlnEFsTS39LLZyIalHvd95SYH3SlYE9zs7LcOk=' 
WHERE 
  key_id = '6566d46493d569424e2feb9c701bdef674cd5a2ec6575ab9fe43cfaea79dad04' 
  AND (
    token = '7bzMgOlnEFsTS39LLZyIalHvd95SYH3SlYE9zs7LcOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026