UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ht4Q+6WGAStekqcZt+tuE2uq2aSa8zxUxkbhC1oZDEw=' 
WHERE 
  key_id = '1ffc2d905783bdfb244a7d94c95ddcb2a570bd5169d9a015f64db346b4a1a367' 
  AND (
    token = 'Ht4Q+6WGAStekqcZt+tuE2uq2aSa8zxUxkbhC1oZDEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034