UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mCob9T/qvZa7Fmhj5/34eSv1kpALtRH8/uPteWU31Q4=' 
WHERE 
  key_id = '9841940341f46563816d16f6c85a3d705cf64ee173a4baa07cf6469d3f48989e' 
  AND (
    token = 'mCob9T/qvZa7Fmhj5/34eSv1kpALtRH8/uPteWU31Q4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031