UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xYHAXD/gVMyXsQx7TOdQ16njM/nB6nc+opj6lLdh8Lg=' 
WHERE 
  key_id = '4d6ff24c10ece3f1c3bfc48ab4848cbc91e504fd3a2f7a48a4df1fde0d3eff8e' 
  AND (
    token = 'xYHAXD/gVMyXsQx7TOdQ16njM/nB6nc+opj6lLdh8Lg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032