UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xaftzn3P17UsLvvmOQjTQb+8cwgPwiGWsVPfIARLPGc=' 
WHERE 
  key_id = '5e23e000f697348cd5ced2de5dce1dfd353566b45e705a004f374ea215346334' 
  AND (
    token = 'Xaftzn3P17UsLvvmOQjTQb+8cwgPwiGWsVPfIARLPGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033