UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qI2wSb2a/1kwFfZgcKBecOaQATknsyqEs1MWMS4o958=' 
WHERE 
  key_id = 'a08b0d88ab227f58da6344926279e2a5f839e8cc2412838dca7c2c511f7741d2' 
  AND (
    token = 'qI2wSb2a/1kwFfZgcKBecOaQATknsyqEs1MWMS4o958=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044