UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nAD80lVxm2/EdlblDXrxDJW3Qij6MSxJdZYGDOmgwaE=' 
WHERE 
  key_id = 'a8e97de835c8e8aba2e00219c16e33dc8e6f0afda95604e23e0277d7ed8d343f' 
  AND (
    token = 'nAD80lVxm2/EdlblDXrxDJW3Qij6MSxJdZYGDOmgwaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055