UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lw2j49b2OkDfblmL479p8VNAXZbLO60nkcJqGVL6kbk=' 
WHERE 
  key_id = '01b4b9495216209f4f717984bcae660e5d9507d2fb93d2d49a32e00747c842a1' 
  AND (
    token = 'Lw2j49b2OkDfblmL479p8VNAXZbLO60nkcJqGVL6kbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034