UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lTcF1VBxsx+f0GxmPoCh6jFjiPWrqSxSt27uUsuqVYQ=' 
WHERE 
  key_id = '86539fcf06dc9d8b7c04fc0d47b251250faf81b0567a3c1ca7508abfe1cad056' 
  AND (
    token = 'lTcF1VBxsx+f0GxmPoCh6jFjiPWrqSxSt27uUsuqVYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024