UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xslb2aAb8yrRdRr/XqXAxn2ZxeUGL1coL+Rt4ylkd1s=' 
WHERE 
  key_id = 'be50471914dc5654595901fcb53f02660cae654f1efcd7b265d4bc84bf9b1728' 
  AND (
    token = 'Xslb2aAb8yrRdRr/XqXAxn2ZxeUGL1coL+Rt4ylkd1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043