UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mpdVzH2G2lNHFcT7OFUN7jUflTJJBrlTHPQvnWjBnzU=' 
WHERE 
  key_id = 'b7b9000ab60e06d077a8ac77a2dfb2e19a5a10d6f4c0450ea82e904a92dee800' 
  AND (
    token = 'mpdVzH2G2lNHFcT7OFUN7jUflTJJBrlTHPQvnWjBnzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023