UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BNV8ji3jUbZ/iTc/p6lPFDc+t2xZi/ocqQy1IhJv8hk=' 
WHERE 
  key_id = '31ede7584b8ff970de80f9681348795ad5979a7a249641e1cb283c4a8c606bb8' 
  AND (
    token = 'BNV8ji3jUbZ/iTc/p6lPFDc+t2xZi/ocqQy1IhJv8hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037