UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XDMGT26zDcMvK5g9JlYdnCYSyLUAHw/mrxvd/1Ef7i4=' 
WHERE 
  key_id = '1707a094a0290d44d673a9d5321b25d0d76fa4ce147323630c0824b50f51e749' 
  AND (
    token = 'XDMGT26zDcMvK5g9JlYdnCYSyLUAHw/mrxvd/1Ef7i4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043