UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Og7w+G3JiW3z+UA/diyiZX6glQrP7izAc76Ig+WaPI4=' 
WHERE 
  key_id = '0c8f87e18db712b508b6867356e4679801ecff872ab5549603cfa39a931d9763' 
  AND (
    token = 'Og7w+G3JiW3z+UA/diyiZX6glQrP7izAc76Ig+WaPI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046