UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4fB5A8VLimg1zo3MPxT8BG+Tdi48wLR1josGWyrb51k=' 
WHERE 
  key_id = 'a0427c9874ab1d97962fc9fc99c3dbb378a4277f04834d0ca8d7f9d5b568231c' 
  AND (
    token = '4fB5A8VLimg1zo3MPxT8BG+Tdi48wLR1josGWyrb51k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018