UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THKmHS+EL5hYf8xd0Hm95Xk1To7JKHAQRgeX26GVSqc=' 
WHERE 
  key_id = '765956e4451fa7541c941f10433d8308e516a51ddeac632135d9828b7dc6a3c0' 
  AND (
    token = 'THKmHS+EL5hYf8xd0Hm95Xk1To7JKHAQRgeX26GVSqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043