UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G11Q8aNIcDZMa96P3qVAX35EGG4Ldi/YK/3c+HzoNkg=' 
WHERE 
  key_id = '641932cdc0f0c0dc9f21723a0d8e518a13a9990cdb832cccf22fb3f943ee0160' 
  AND (
    token = 'G11Q8aNIcDZMa96P3qVAX35EGG4Ldi/YK/3c+HzoNkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026