UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DGfP1WkEhecciH+W+ZCTRP3FBK/RxsLD9nB5uJtbOEk=' 
WHERE 
  key_id = 'dda47e5aa520df07f222c1c57285d4004fc3cc5119679e1703fc01145568e315' 
  AND (
    token = 'DGfP1WkEhecciH+W+ZCTRP3FBK/RxsLD9nB5uJtbOEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046