UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CKRL9VNEjIsYf50r7QAf+T/CY7n4prRe3T68k0MSRRQ=' 
WHERE 
  key_id = '3d3efa7f09c52f4717d285df3876f6f227055d4e1aa5fa4be461e903da1dc322' 
  AND (
    token = 'CKRL9VNEjIsYf50r7QAf+T/CY7n4prRe3T68k0MSRRQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041