UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XLvH3xthpmuI1pQr+MvfCc5wesx/1EHHJw6CKG5MfwA=' 
WHERE 
  key_id = '0c94caab0e6d62c96fde8b40899aa7ee94967051d507529686dfd77df921efbe' 
  AND (
    token = 'XLvH3xthpmuI1pQr+MvfCc5wesx/1EHHJw6CKG5MfwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029